//
//  KBListenTableViewCell.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "KBListenTableViewCell.h"

@implementation KBListenTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    
    // 图片
    _coverPath = [[UIImageView alloc] init];
    [self.contentView addSubview:_coverPath];
    
    [_coverPath mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.and.top.mas_equalTo(10);
//        make.bottom.mas_equalTo(- 10);
//        make.size.with.mas_equalTo(SCREEN_WIDTH*0.27);
        make.size.mas_equalTo(CGSizeMake(90, 90));
    }];
    
    // 标题
    _title = [[UILabel alloc] init];
    _title.text = @"加法减法上课了解放了金fsafasfafa卡";
    _title.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:_title];
    [_title mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(_coverPath.mas_right).offset(10);
        make.top.mas_equalTo(_coverPath);
//        make.right.mas_equalTo(-20);
        make.size.mas_equalTo(CGSizeMake(230, 20));

    }];
    
    // 副标题
    _subtitle = [[UILabel alloc] init];
    _subtitle.font = [UIFont systemFontOfSize:15];
    _subtitle.textColor = [UIColor colorWithRed:0.67 green:0.67 blue:0.67 alpha:1];
    [self.contentView addSubview:_subtitle];
    
    [_subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(_title);
        make.top.equalTo(_title.mas_bottom).offset(3);
//        make.right.mas_equalTo(-40);
        make.size.mas_equalTo(CGSizeMake(230, 16));

        
    }];
    
    UIImageView *myImageView = [[UIImageView alloc]init];
    myImageView.image = [UIImage imageNamed:@"find_specialicon@2x.png"];
    [self.contentView addSubview:myImageView];
    [myImageView mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(_title);
        make.top.equalTo(_subtitle.mas_bottom).offset(18);
        make.size.mas_equalTo(CGSizeMake(12, 12));
        
    }];
    
    
    // 几张
    _footnote = [[UILabel alloc] init];
    _footnote.text = @"sgakljgaklj";
    _footnote.font = [UIFont systemFontOfSize:13];
    _footnote.textColor = [UIColor colorWithRed:0.67 green:0.67 blue:0.67 alpha:1];
    [self.contentView addSubview:_footnote];
    
    [_footnote mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.left.equalTo(myImageView).offset(15);
        make.top.equalTo(_subtitle.mas_bottom).offset(18);
        make.size.mas_equalTo(CGSizeMake(100, 12));
        
    }];
    UIImageView *myImage = [[UIImageView alloc]init];
    myImage.image = [UIImage imageNamed:@"findcell_arrow@2x.png"];
    [self.contentView addSubview:myImage];
    
    [myImage mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(-20);
        make.top.mas_equalTo(45);
        make.size.mas_equalTo(CGSizeMake(10, 12));
        
    }];
}

- (void)setDataDic:(NSDictionary *)dataDic
{
    _title.text = dataDic[@"title"];
    _subtitle.text = dataDic[@"subtitle"];
    NSURL *url = [NSURL URLWithString:dataDic[@"coverPath"]];
    [_coverPath sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    _footnote.text = dataDic[@"footnote"];
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
